package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.common.BizEnums.CommonEnums;
import com.financing.wap.dao.ISalesPrizesPeopleDao;
import com.financing.wap.dto.SalesPrizesPeopleDTO;
import com.financing.wap.service.ISalesPrizesPeopleService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * sales_prizes_people  
 * 销售抽奖人数 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("salesPrizesPeopleService")
public class SalesPrizesPeopleServiceImpl implements ISalesPrizesPeopleService{

	@Autowired
	private ISalesPrizesPeopleDao salesPrizesPeopleDao;

	@Override
	public int insert(SalesPrizesPeopleDTO salesPrizesPeople) throws SQLException {
		DTOdateSetUtil.setCreateInfo(salesPrizesPeople);
		DTOdateSetUtil.setUpdateInfo(salesPrizesPeople);
		salesPrizesPeople.setDeleteTag(CommonEnums.DELETE_FLAG_1);
		return salesPrizesPeopleDao.insert(salesPrizesPeople);
	}

	@Override
	public void update(SalesPrizesPeopleDTO salesPrizesPeople) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(salesPrizesPeople);
		salesPrizesPeopleDao.update(salesPrizesPeople);
	}

	@Override
	public void updateForce(SalesPrizesPeopleDTO salesPrizesPeople) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(salesPrizesPeople);
		salesPrizesPeopleDao.updateForce(salesPrizesPeople);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		salesPrizesPeopleDao.delete(id);
	}
	
	@Override
	public List<SalesPrizesPeopleDTO> queryList(SalesPrizesPeopleDTO salesPrizesPeople) throws SQLException {
		return salesPrizesPeopleDao.queryList(salesPrizesPeople);
	}

	@Override
	public int queryListCount(SalesPrizesPeopleDTO salesPrizesPeople) throws SQLException {
		return salesPrizesPeopleDao.queryListCount(salesPrizesPeople);
	}

	@Override
	public SalesPrizesPeopleDTO loadById(Integer id) throws SQLException {
		return salesPrizesPeopleDao.loadById(id);
	}
 	@Override
	public SalesPrizesPeopleDTO queryListGetFirst(SalesPrizesPeopleDTO salesPrizesPeople)
			throws SQLException {
		 List<SalesPrizesPeopleDTO> queryList = queryList(salesPrizesPeople);
		 if(queryList==null||queryList.size()==0){
			 return new SalesPrizesPeopleDTO();
		 }
		 return queryList.get(0);
	}
}
